<extend name="Public/base"/>

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>渠道统计</h2>

	</div>
    <div class="tools">
            <form action="{:U()}" method="post">
                选择时间：
                <input type="text" value="{$begin}" name="time_start" class="date" style="width:80px;" onclick="laydate()"> - <input type="text" value="{$end}" name="time_end" class="date" style="width:80px;" onclick="laydate()">
                <span class="buttons">
                    <input type="submit"  id="submit" class="btn" value="开始查询">
                </span>
            </form>
    </div>

        <div id="shuju" style="width: 100%;height:400px;margin-top: 20px;"></div>
<script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('shuju'));

        // 指定图表的配置项和数据
        

        option = {
            title : {
                text: '各渠道成交量统计',
                x:'center'
            },
            tooltip : {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data: [<foreach  name="_list" item="vo">
                               '{$vo.name}',
                           </foreach>]
            },
            series : [
                {
                    name: '成交来源',
                    type: 'pie',
                    radius : '55%',
                    center: ['50%', '60%'],
                    data:[
                            <foreach  name="_list" item="vo">
                                    {value:<?php echo $vo['zcj']; ?>, name:'<?php echo $vo['name']; ?>'},
                            </foreach>
                          ],
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 40,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };


        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
      
	<!-- 数据列表 -->
	<div class="data-table">
        <div class="data-table table-striped">
<table class="">
    <thead>
        <tr>
		<th class="">渠道</th>
        <th class="">建单</th>
		<th class="">微信</th>
        <th class="">手机</th>
		<th class="">渠道费用</th>
		<th class="">邀约</th>
        <th class="">邀约率</th>
		<th class="">进店量</th>
        <th class="">进店率</th>
		<th class="">未到店量</th>
        <th class="">未到店</th>
		<th class="">流失</th>
        <th class="">流失率</th>
        <th class="">线上成交</th>
        <th class="">线上占比</th>
        <th class="">线下成交</th>
        <th class="">线下占比</th>
		<th class="">总成交</th>
        <th class="">成交率</th>
		<th class="">每单成本</th>
        <th class="">每单均价</th>
		</tr>
    </thead>
    <tbody>
	<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
			<td>{$vo.name}</td>
			<td>{$vo.jd}</td>
            <td>{$vo.qq}</td>
            <td>{$vo.phone}</td>
			<td><?php echo number_format($vo['feiyong'],0); ?></td>
            <td>{$vo.yytime}</td>
            <td><?php echo number_format($vo['yytime']/$vo['jd'],2)*100; ?>%</td>
			<td>{$vo.jindtime}</td>
            <td><?php echo number_format($vo['jindtime']/$vo['yytime'],2)*100; ?>%</td>
			<td>{$vo.wddtime}</td>
            <td><?php echo number_format($vo['wddtime']/$vo['yytime'],2)*100; ?>%</td>
            <td>{$vo.lstime}</td>
            <td><?php echo number_format($vo['lstime']/$vo['yytime'],2)*100; ?>%</td>
            <td>{$vo.xscj}</td>
            <td><?php echo number_format($vo['xscj']/$zj['xscj'],2)*100; ?>%</td>
            <td>{$vo.xxcj}</td>
            <td><?php echo number_format($vo['xxcj']/$zj['xxcj'],2)*100; ?>%</td>
            <td>{$vo.zcj}</td>
            <td><?php echo number_format($vo['zcj']/$vo['yytime'],2)*100; ?>%</td>
			<td><?php echo number_format($vo['feiyong']/$vo['zcj'],0); ?></td>
            <td><?php echo number_format($vo['setmoney']/$vo['zcj'],0); ?></td>
		</tr>
		</volist>
		<else/>
		<td colspan="16" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
        <tr>
            <td style="background-color:#51D0CA;">总计</td>
            <td style="background-color:#51D0CA;">{$zj.jd}</td>
            <td style="background-color:#51D0CA;">{$zj.qq}</td>
            <td style="background-color:#51D0CA;">{$zj.phone}</td>
			<td style="background-color:#51D0CA;"><?php echo number_format($zj['feiyong'],0); ?></td>
            <td style="background-color:#51D0CA;">{$zj.yytime}</td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['yytime']/$zj['jd'],2)*100; ?>%</td>
			<td style="background-color:#51D0CA;">{$zj.jindtime}</td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['jindtime']/$zj['yytime'],2)*100; ?>%</td>
			<td style="background-color:#51D0CA;">{$zj.wddtime}</td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['wddtime']/$zj['yytime'],2)*100; ?>%</td>
            <td style="background-color:#51D0CA;">{$zj.lstime}</td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['lstime']/$zj['yytime'],2)*100; ?>%</td>
            <td style="background-color:#51D0CA;">{$zj.xscj}</td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['xscj']/$zj['zcj'],2)*100; ?>%</td>
            <td style="background-color:#51D0CA;">{$zj.xxcj}</td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['xxcj']/$zj['zcj'],2)*100; ?>%</td>
            <td style="background-color:#51D0CA;">{$zj.zcj}</td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['zcj']/$zj['yytime'],2)*100; ?>%</td>
			<td style="background-color:#51D0CA;"><?php echo number_format($zj['feiyong']/$zj['zcj'],0); ?></td>
            <td style="background-color:#51D0CA;"><?php echo number_format($zj['setmoney']/$zj['zcj'],0); ?></td>
        </tr>
	</tbody>
    </table>

        </div>
    </div>
    <div class="page">

    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    
</block>
